using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;

namespace Imagination.Partitioning
{
    /// <summary>
    /// SimpleZone implements a single Zone encompassing the entire scene.
    /// It doesn't actually do any partitioning, and is not recommended 
    /// for anything but basic use.
    /// </summary>
    public class SimpleZone : Zone
    {
        private List<Thing> things;

        internal List<Thing> Things
        {
            get { return things; }
        }

        public SimpleZone()
        {
            things = new List<Thing>();
        }

        public override void ThingMoved(Thing thing)
        {
            //  do nothing
        }

        public override void AddThing(Thing thing)
        {
            things.Add(thing);
            thing.Zone = this;
        }

        public override void RemoveThing(Thing thing)
        {
            things.Remove(thing);
            thing.Zone = null;
        }

        public override void ClearThings()
        {
            things.Clear();
        }

        public override IEnumerable<Thing> EnumerateThings()
        {
            foreach(Thing thing in things)
                yield return thing;
        }

        public override ContainmentType Contains(Thing thing)
        {
            return ContainmentType.Contains;
        }
    }
}
